xen.git
17 years agopv-on-hvm drivers: build fixes for Linux 2.6.27+
Keir Fraser [Mon, 24 Nov 2008 11:11:20 +0000 (11:11 +0000)]
pv-on-hvm drivers: build fixes for Linux 2.6.27+

Make the drivers build properly in a 2.6.27 environment as well as
against a kernel with pv-ops Xen configured on (in the latter case
more work would be needed to also make the drivers work, as there's a
large number of duplicate exports).

Portions from Charles Arnold <carnold@novell.com>.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoPCI interface changes for PCIE-AER enabling
Keir Fraser [Mon, 24 Nov 2008 11:06:16 +0000 (11:06 +0000)]
PCI interface changes for PCIE-AER enabling

This patch reflects some pci interface changes in pciif.h in XEN head
file. And also add domain shutdown support in xend for shutting domain
from DOM0 kernel when non-recoverable uncorrected pci error happens.

Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Ke Liping <liping.ke@intel.com>
17 years agox86: make NR_IRQS build-time configurable
Keir Fraser [Thu, 20 Nov 2008 14:23:59 +0000 (14:23 +0000)]
x86: make NR_IRQS build-time configurable

While keeping the NR_IRQS default at 256 here, I think it would be a
good thing to set it to a higher value to make sure no new mixing of
irq and vector spaces slip in.

Tested with NR_IRQS forced to 1024.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoEliminate NR_IRQ_VECTORS
Keir Fraser [Thu, 20 Nov 2008 14:23:33 +0000 (14:23 +0000)]
Eliminate NR_IRQ_VECTORS

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoProperly distinguish irq and vector spaces
Keir Fraser [Thu, 20 Nov 2008 14:22:54 +0000 (14:22 +0000)]
Properly distinguish irq and vector spaces

This makes sure that there are no assumptions about NR_IRQS==NR_VECTORS
anymore, and it also renames various variables to properly reflect
what they represent.

While coded correctly, I wonder whether dump_irqs() shouldn't iterate
over the vector space rather than the irq space, so that MSI entries
are also processed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: freeze non-current vCPUs of dom0 before entering S5
Keir Fraser [Thu, 20 Nov 2008 14:21:17 +0000 (14:21 +0000)]
x86: freeze non-current vCPUs of dom0 before entering S5

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoxend: Make _setCPUAffinity() errors nonfatal on domain resume
Keir Fraser [Thu, 20 Nov 2008 14:17:09 +0000 (14:17 +0000)]
xend: Make _setCPUAffinity() errors nonfatal on domain resume

This patch allows domains to be resumed on different number of CPUs. After
c/s 18764, a domain cannot be resumed when _setCPUAffinity() fails, which
happens when affinity should be set to a non-existent CPU. This patch
makes _setCPUAffinity() errors nonfatal.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
17 years agox86, hpet: Fix initialisation of secondary timers.
Keir Fraser [Thu, 20 Nov 2008 14:15:50 +0000 (14:15 +0000)]
x86, hpet: Fix initialisation of secondary timers.

Each channel may have different settings, and in the original
implementation, other Tn configuration will accidently overwrite T0
configuration.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
17 years agoxenapi: fix valid_object typo
Keir Fraser [Thu, 20 Nov 2008 14:14:20 +0000 (14:14 +0000)]
xenapi: fix valid_object typo

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
17 years agox86: Fix build for some versions of gcc.
Keir Fraser [Wed, 19 Nov 2008 19:13:22 +0000 (19:13 +0000)]
x86: Fix build for some versions of gcc.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values
Keir Fraser [Wed, 19 Nov 2008 16:11:39 +0000 (16:11 +0000)]
x86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: support CPUID hypervisor feature bit
Keir Fraser [Wed, 19 Nov 2008 16:10:39 +0000 (16:10 +0000)]
x86: support CPUID hypervisor feature bit

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, s3: Sync platform stamps at time suspend.
Keir Fraser [Wed, 19 Nov 2008 13:17:31 +0000 (13:17 +0000)]
x86, s3: Sync platform stamps at time suspend.

platform_timer_stamp and stime_platform_stamp are synced
to platform timer in time calibration (1s interval), and
thus doesn't reflect the latest value. If they're not
synced at time suspend, the offset can be lost after S3
resume. Average 0.8s lag-behind is observed for each S3
action, which accumulates to TOD inaccuracy.

Signed-off-by Kevin Tian <kevin.tian@intel.com>

17 years agoRemove Xen-private definitions from kexec public header.
Keir Fraser [Wed, 19 Nov 2008 13:13:39 +0000 (13:13 +0000)]
Remove Xen-private definitions from kexec public header.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxen s3, No need to check idle vcpu before update_vcpu_system_time().
Keir Fraser [Wed, 19 Nov 2008 12:52:03 +0000 (12:52 +0000)]
xen s3, No need to check idle vcpu before update_vcpu_system_time().

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
17 years agox86, hpet: Avoud double initialisation on boot or after S3.
Keir Fraser [Wed, 19 Nov 2008 12:48:31 +0000 (12:48 +0000)]
x86, hpet: Avoud double initialisation on boot or after S3.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix the clocksource= boot parameter after c/s 18786.
Keir Fraser [Wed, 19 Nov 2008 12:40:23 +0000 (12:40 +0000)]
x86: Fix the clocksource= boot parameter after c/s 18786.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm: Fix domain restore bug with Intel VLAPIC acceleration.
Keir Fraser [Tue, 18 Nov 2008 15:59:26 +0000 (15:59 +0000)]
x86, hvm: Fix domain restore bug with Intel VLAPIC acceleration.

r18383 mark video memory as ram, and make all valid pages migrated,
including vlapic page (0xFEE00), and share page(0xFFFFF).
An extra memory population for lapic page would override previous
mapping then cause HVM guest with vlapic acceleration hang.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Re-initialise HPET on resume from S3
Keir Fraser [Tue, 18 Nov 2008 15:55:14 +0000 (15:55 +0000)]
x86: Re-initialise HPET on resume from S3

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, time: Clean up platform timer initialisation.
Keir Fraser [Tue, 18 Nov 2008 15:39:31 +0000 (15:39 +0000)]
x86, time: Clean up platform timer initialisation.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm: Implement interrupt routing to least priority processor.
Keir Fraser [Tue, 18 Nov 2008 11:16:36 +0000 (11:16 +0000)]
x86, hvm: Implement interrupt routing to least priority processor.

Instead of round robin the vcpu with the lowest processor
priority is selected for the interrupt. If multiple vcpus
share the same low priority then interrupts are distributed between
those round robin.

Signed-off-by: Juergen Gross <juergen.gross@fujitsu-siemens.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovtd: fix memory allocation from NUMA node for VT-d.
Keir Fraser [Tue, 18 Nov 2008 10:52:42 +0000 (10:52 +0000)]
vtd: fix memory allocation from NUMA node for VT-d.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
17 years agohvm: Fix hvm_vcpu_reset_state() to act on specified domain, rather
Keir Fraser [Mon, 17 Nov 2008 15:55:56 +0000 (15:55 +0000)]
hvm: Fix hvm_vcpu_reset_state() to act on specified domain, rather
than current.

Signed-off-by: Liping Ke <liping.ke@intel.com>
17 years agotools: use sysfs interface to balloon driver if present
Keir Fraser [Mon, 17 Nov 2008 15:54:31 +0000 (15:54 +0000)]
tools: use sysfs interface to balloon driver if present

The pvops dom0 kernel does not expose the balloon driver via
/proc/xen, so use the sysfs interface.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
17 years agoRemove NR_PIRQS definition -- always use NR_IRQS.
Keir Fraser [Fri, 14 Nov 2008 14:33:25 +0000 (14:33 +0000)]
Remove NR_PIRQS definition -- always use NR_IRQS.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix to save CPU affinity for xm save/restore
Keir Fraser [Fri, 14 Nov 2008 14:27:51 +0000 (14:27 +0000)]
Fix to save CPU affinity for xm save/restore
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agovt-d: Fix ia64 build.
Keir Fraser [Fri, 14 Nov 2008 14:27:08 +0000 (14:27 +0000)]
vt-d: Fix ia64 build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: don't disable MSI in order to mask an IRQ
Keir Fraser [Thu, 13 Nov 2008 16:31:08 +0000 (16:31 +0000)]
x86: don't disable MSI in order to mask an IRQ

... as that's not really correct, and there are devices which can't
even cope with that. Instead, check whether an MSI IRQ can be masked,
and if it can't, treat it just like a level triggered IO-APIC IRQ.

There's one other bug fix in here, correcting an off-by-one error on
the entry_nr range check in __pci_enable_msix().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86, hvm: Provide access to limited VCPUOP_ hypercalls.
Keir Fraser [Thu, 13 Nov 2008 14:19:56 +0000 (14:19 +0000)]
x86, hvm: Provide access to limited VCPUOP_ hypercalls.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Use the shadow-code PT walker from the HAP functions
Keir Fraser [Thu, 13 Nov 2008 13:03:16 +0000 (13:03 +0000)]
x86: Use the shadow-code PT walker from the HAP functions

Replace the guts of the HAP pagetable walker with a call to the
newly-commonified walker from the shadow code.  This reduces
duplication, and gives HAP guests proper access control and A/D-bit
setting for memory accesses from the emulator

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agox86: Move the guest pagetable walker out of shadow/multi.c
Keir Fraser [Thu, 13 Nov 2008 13:02:08 +0000 (13:02 +0000)]
x86: Move the guest pagetable walker out of shadow/multi.c

Move the guest PT walker into its own file, and purge it of references
to the rest of the shadow code.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agox86: Move guest_l*e definitions into common code
Keir Fraser [Thu, 13 Nov 2008 13:01:22 +0000 (13:01 +0000)]
x86: Move guest_l*e definitions into common code

Move the definitions of guest pagetable types and the guest pagetable
walk record out of the shadow-code headers into asm-x86.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agoxm: display domain id on domain creation
Keir Fraser [Thu, 13 Nov 2008 10:50:50 +0000 (10:50 +0000)]
xm: display domain id on domain creation

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agox86: add SSE-based copy_page()
Keir Fraser [Wed, 12 Nov 2008 12:04:15 +0000 (12:04 +0000)]
x86: add SSE-based copy_page()

In top of the highmem asstance hypercalls added earlier, this provides
a performance improvement of another 12% (measured on Xeon E5345) for
the page copying case.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: reduce GDT switching
Keir Fraser [Wed, 12 Nov 2008 12:01:35 +0000 (12:01 +0000)]
x86: reduce GDT switching

Both idle and HVM vCPU-s can easily run on the GDT mapped into general
hypervisor space (rather than that placed in per-vCPU virtual space).

This makes unnecessary some of the additions c/s 18520 did.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoxend, pciif: fix some indentation
Keir Fraser [Wed, 12 Nov 2008 11:50:25 +0000 (11:50 +0000)]
xend, pciif: fix some indentation

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agohvm: fix single stepping on debugger
Keir Fraser [Tue, 11 Nov 2008 11:47:03 +0000 (11:47 +0000)]
hvm: fix single stepping on debugger

The debuggee domain will die with unexpected trap
on single stepping of emulated instruction.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovmx: Clean up exception delivery logic.
Keir Fraser [Tue, 11 Nov 2008 11:35:00 +0000 (11:35 +0000)]
vmx: Clean up exception delivery logic.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: fix getvcpucontext for HVM segment registers
Keir Fraser [Tue, 11 Nov 2008 11:13:57 +0000 (11:13 +0000)]
x86: fix getvcpucontext for HVM segment registers

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovmx: Fix realmode exception delivery to correctly check stack pointer size.
Keir Fraser [Tue, 11 Nov 2008 11:10:59 +0000 (11:10 +0000)]
vmx: Fix realmode exception delivery to correctly check stack pointer size.

Bug tracked down by Tim Deegan <tim.deegan@citrix.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovtd cleanup: change some function return types to void
Keir Fraser [Tue, 11 Nov 2008 11:07:21 +0000 (11:07 +0000)]
vtd cleanup: change some function return types to void

iommu_suspend(), iommu_resume(), iommu_enable() translation don't have
meaningful return values.  Changed their function types to void.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
17 years agoxend: Restore CPU affinity on domain resume.
Keir Fraser [Tue, 11 Nov 2008 11:06:27 +0000 (11:06 +0000)]
xend: Restore CPU affinity on domain resume.

Move affinity-setting logic into its own function and call from
relevant places.

From: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios: add a barebone net/if.h
Keir Fraser [Tue, 11 Nov 2008 11:03:58 +0000 (11:03 +0000)]
minios: add a barebone net/if.h

net/if.h is a standard header but unfortunately lwip doesn't provide
it for any target but linux. Therefore I am adding a net/if.h, with an
empty implementation of the declared functions.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
17 years agovtd: fix interrupt remapping to handle SMI RTE's with uninitialized
Keir Fraser [Mon, 10 Nov 2008 10:41:41 +0000 (10:41 +0000)]
vtd: fix interrupt remapping to handle SMI RTE's with uninitialized
reserved fields

Some BIOS does not zero out reserve fields in IOAPIC RTE's.
clear_IO_APIC() zeroes out all RTE's except for RTE with MSI delivery
type.  This is a problem when the host OS converts SMI delivery type
to some other type but leaving the reserved field uninitialized.  This
can cause interrupt remapping table out of bound error if "format"
field is 1 and the uninitialized "index" field has a value that that
is larger than the maximum index of interrupt remapping table.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>=
17 years agox86, vmx realmode: Stack manipulation on interrupt/exception injection
Keir Fraser [Fri, 7 Nov 2008 17:06:21 +0000 (17:06 +0000)]
x86, vmx realmode: Stack manipulation on interrupt/exception injection
should respect SS size, not CS size.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenpm: Fix an error path.
Keir Fraser [Fri, 7 Nov 2008 17:00:39 +0000 (17:00 +0000)]
xenpm: Fix an error path.

Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
17 years agox86, hvm: Better MTRR type check.
Keir Fraser [Thu, 6 Nov 2008 11:50:21 +0000 (11:50 +0000)]
x86, hvm: Better MTRR type check.
From: Disheng Su <disheng.su@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix an inverted flags conversion in map_page_to_xen()
Keir Fraser [Thu, 6 Nov 2008 11:48:11 +0000 (11:48 +0000)]
x86: Fix an inverted flags conversion in map_page_to_xen()
Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: Use gfn_to_mfn() rather than gfn_to_mfn_current() in callers
Keir Fraser [Thu, 6 Nov 2008 11:07:02 +0000 (11:07 +0000)]
x86: Use gfn_to_mfn() rather than gfn_to_mfn_current() in callers
which can execute on arbitrary domains.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: PV support for hugepages
Keir Fraser [Wed, 5 Nov 2008 10:57:21 +0000 (10:57 +0000)]
x86: PV support for hugepages

Hugepage support must be enabled via the hypervisor command line
option "allowhugepage". There is currently no support in the tools for
saving/restoring/migrating guests who use hugepages.

Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>
17 years agox86: fix a typo
Keir Fraser [Wed, 5 Nov 2008 10:26:19 +0000 (10:26 +0000)]
x86: fix a typo

Signed-off-by Kevin Tian <kevin.tian@intel.com>

17 years agox86, hvm: Only warn on memory attribute conflicts for real RAM.
Keir Fraser [Wed, 5 Nov 2008 10:25:11 +0000 (10:25 +0000)]
x86, hvm: Only warn on memory attribute conflicts for real RAM.

From: Disheng Su <disheng.su@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend, security: Prevent changing of the policy while VMs are migrating
Keir Fraser [Wed, 5 Nov 2008 10:23:26 +0000 (10:23 +0000)]
xend, security: Prevent changing of the policy while VMs are migrating

The net changes of this patch are that the reader-side lock is put
into the path of the migration code and the writer lock into the path
of the code that handles the changing of the policy. Simultaneous
migrations of multiple hosts still work after this lock has been added.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
17 years agoxend: Add a multi-reader-single-writer lock implementation
Keir Fraser [Wed, 5 Nov 2008 10:22:19 +0000 (10:22 +0000)]
xend: Add a multi-reader-single-writer lock implementation

This patch adds a reader-writer lock primitive to xend since python
does not provide it by default. The implementation is based on a
condition variable. Some test code is appended at the end of the file.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
17 years agotools/hotplug: Separate OS-specific scripts.
Keir Fraser [Tue, 4 Nov 2008 12:13:42 +0000 (12:13 +0000)]
tools/hotplug: Separate OS-specific scripts.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: allow grant table originating ptes to have their guest available
Keir Fraser [Tue, 4 Nov 2008 11:46:00 +0000 (11:46 +0000)]
x86: allow grant table originating ptes to have their guest available
bits set.

In order to allow 2.6.27's get_user_pages_fast() to correctly detect
granted pages (so they would be passed to get_user_pages()), it must
be possible to tell the grant table code in Xen to set the three
available bits in the pte-s it creates.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoxentrace: Trace mmio/io read/write value
Keir Fraser [Mon, 3 Nov 2008 13:36:24 +0000 (13:36 +0000)]
xentrace: Trace mmio/io read/write value

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix GRANT_PTE_FLAGS.
Keir Fraser [Mon, 3 Nov 2008 10:32:54 +0000 (10:32 +0000)]
x86: Fix GRANT_PTE_FLAGS.

Since page table entries created through e.g. GNTTABOP_map_grant_ref
are being passed through adjust_guest_l1e(), they must not generally
get _PAGE_USER set - this will be taken care of by adjust_guest_l1e(),
and it will ensure that these don't get _PAGE_GLOBAL set
inadvertently.

Due to the implied security aspect here (_PAGE_GLOBAL getting set on
kernel pages for x86-64), I'd like to ask that this also be applied to
older maintained branches.

At the same time, set _PAGE_NX for pte-s created for grants (as long
as hardware supports it), since it should be only data pages that remote
domains are being given access to.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: simplify page reference handling for partially (in-)validated pages
Keir Fraser [Mon, 3 Nov 2008 10:32:02 +0000 (10:32 +0000)]
x86: simplify page reference handling for partially (in-)validated pages

Simplify general page reference management for preempted (partially
[in-]validated) pages: Reserve on reference that can be acquired
without the risk of overflowing the reference count, thus allowing to
have a simplified get_page() equivalent that cannot fail (but must be
used with care).

Doing this conversion pointed out a latent issue in the changes done
previously in this area: The extra reference must be acquired before
the 'normal' reference gets dropped, so the patch fixes this at once
in both the alloc_page_type() and free_page_type() paths (it's really
only the latter that failed to work with the change described above).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoCpufreq: Enhance hypervisor px sanity check
Keir Fraser [Mon, 3 Nov 2008 10:24:17 +0000 (10:24 +0000)]
Cpufreq: Enhance hypervisor px sanity check

This patch enhances hypervisor px sanity check in 2 level:
Firstly, move per-cpu-level px sanity check from each cpufreq driver
to common point (@ hypercall path). Secondly, add per-domain-level px
sanity check to common point (@ cpufreq_add_cpu).

Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
17 years agoxend: ioport & irq persistence thru reboot
Keir Fraser [Mon, 3 Nov 2008 10:23:09 +0000 (10:23 +0000)]
xend: ioport & irq persistence thru reboot

When a domU is configured for a serial port as documented at:
   http://wiki.xensource.com/xenwiki/InstallationNotes

the VM does see the serial port, however when dom0 is rebooted and
the VM started it no longer has access to the serial port.

xm list -l <vm> no longer shows the ioports or irq attributes

Attached patch adds implementation of getDeviceConfiguration(),
returns details dict and implements waitForDevice() to irqif.py and
iopif.py.

Also added preprocess_irq() to create.py.

Signed-off-by: Pat Campbell <plc@novell.com>
17 years agoChange timer implementation to allow variable 'slop' in how late
Keir Fraser [Fri, 31 Oct 2008 14:02:39 +0000 (14:02 +0000)]
Change timer implementation to allow variable 'slop' in how late
timers are fired. The default continues to be 50us, but this can be
configured on Xen's command line.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Use the right error code when testing for spurious pagefaults
Keir Fraser [Thu, 30 Oct 2008 15:04:27 +0000 (15:04 +0000)]
x86: Use the right error code when testing for spurious pagefaults

Shadowed PV domains may take pagefaults with PFEC_reserved_bit bit
set, which are then turned into page-not-present faults by the shadow
code. Since that changes the error code in the regs structure, we need
to remember the old error code when we later check for spurious page
faults or we'll get false positives.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agox86: fix preemptable page type handling
Keir Fraser [Thu, 30 Oct 2008 14:53:24 +0000 (14:53 +0000)]
x86: fix preemptable page type handling

- retain a page reference when PGT_partial is set on a page (and drop
  it when clearing that flag)
- don't drop a page reference never acquired when freeing the page
  type
  of a page where the allocation of the type got preempted (and never
  completed)
- don't acquire a page reference when allocating the page type of a
  page where freeing the type got preempted (and never completed, and
  hence didn't drop the respective reference)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: eliminate domain cleanup hack in favor of using the preemptable
Keir Fraser [Thu, 30 Oct 2008 14:37:48 +0000 (14:37 +0000)]
x86: eliminate domain cleanup hack in favor of using the preemptable
flavors of the respective functions.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoCPUIDLE: Support C1 FFH entry
Keir Fraser [Thu, 30 Oct 2008 13:33:40 +0000 (13:33 +0000)]
CPUIDLE: Support C1 FFH entry

Add support for C1 FFH (mwait) entry. Meanwhile add timing for C1. The
timing for C1 should be accurate for FFH case, but may not for halt case.

Signed-off-by: Wei Gang <gang.wei@intel.com>
17 years agoCPUIDLE: add idx field
Keir Fraser [Thu, 30 Oct 2008 13:33:17 +0000 (13:33 +0000)]
CPUIDLE: add idx field

This patch adds an idx field in the 'struct acpi_processor_cx'. It can
simplify some coding lines.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>=
17 years agorombios: fix int13h for floppy disk
Keir Fraser [Thu, 30 Oct 2008 13:27:07 +0000 (13:27 +0000)]
rombios: fix int13h for floppy disk

A floppy on HVM can't be read correctly.
This fix is taken from upstream bochs-2.3.7.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agocpufreq: Fix another build failure.
Keir Fraser [Wed, 29 Oct 2008 19:06:52 +0000 (19:06 +0000)]
cpufreq: Fix another build failure.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agocpufreq.c: shut up compiler about cpufreq_dom
Keir Fraser [Wed, 29 Oct 2008 16:58:05 +0000 (16:58 +0000)]
cpufreq.c: shut up compiler about cpufreq_dom

Some versions of GCC are too stupid to figure out that cpufreq_dom is
only used if !!domexist and always set in that case, and complain that
it may be used uninitialised.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Fix relinquish_memory() for PGT_partial pages.
Keir Fraser [Wed, 29 Oct 2008 13:09:37 +0000 (13:09 +0000)]
x86: Fix relinquish_memory() for PGT_partial pages.

Original patch by Jan Beulich.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios: Define __INSIDE_MINIOS__ rather than __MINIOS__
Keir Fraser [Wed, 29 Oct 2008 12:04:38 +0000 (12:04 +0000)]
minios: Define __INSIDE_MINIOS__ rather than __MINIOS__

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest
Keir Fraser [Wed, 29 Oct 2008 10:19:35 +0000 (10:19 +0000)]
x86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agocpufreq: domain structure update from array to linked list
Keir Fraser [Wed, 29 Oct 2008 10:14:13 +0000 (10:14 +0000)]
cpufreq: domain structure update from array to linked list

Current cpufreq domain is an array cpufreq_dom_map[NR_CPUS].
However, domain number may be sparse or bigger than NR_CPUS.

Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
17 years agox86: Fix circular page reference destruction in relinquish_memory().
Keir Fraser [Tue, 28 Oct 2008 11:25:20 +0000 (11:25 +0000)]
x86: Fix circular page reference destruction in relinquish_memory().

Tested by Jan Beulich and fixes a memory leak, but there is more to be
done here.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend: Fix typo in waitForBackend() for phantom VBDs
Keir Fraser [Tue, 28 Oct 2008 10:37:30 +0000 (10:37 +0000)]
xend: Fix typo in waitForBackend() for phantom VBDs

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agohvm: Do not mess with APIC timer deadline if in one-shot mode.
Keir Fraser [Tue, 28 Oct 2008 10:36:22 +0000 (10:36 +0000)]
hvm: Do not mess with APIC timer deadline if in one-shot mode.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenoprof: Small fixes.
Keir Fraser [Tue, 28 Oct 2008 10:35:15 +0000 (10:35 +0000)]
xenoprof: Small fixes.

Signed-off-by: Ronghui Duan <ronghui.duan@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios: do not expose #define current to applications
Keir Fraser [Mon, 27 Oct 2008 18:51:52 +0000 (18:51 +0000)]
minios: do not expose #define current to applications

Currently the minios headers do this:
 #define current get_current()
Obviously when porting general code to this environment, this can
cause problems !

The attached patch arranges for this only to be done if
 #define __MINIOS__
is declared, which is set up by the makefile in extras/mini-os.

Suppressing the namespace pollution is necessary to get recent
upstream qemu's to compile, since they (quite properly) use `current'
as an ordinary identifier.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Disable MSI IRQs until locking is fixed.
Keir Fraser [Mon, 27 Oct 2008 14:59:01 +0000 (14:59 +0000)]
x86: Disable MSI IRQs until locking is fixed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6.
Keir Fraser [Mon, 27 Oct 2008 13:31:15 +0000 (13:31 +0000)]
x86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6.

Signed-off-by: Ronghui Duan <ronghui.duan@intel.com>
17 years agox86: highmem handling assistance hypercalls
Keir Fraser [Mon, 27 Oct 2008 13:29:35 +0000 (13:29 +0000)]
x86: highmem handling assistance hypercalls

While looking at the origin of very frequently executed hypercalls I
realized that the high page accessor functions in Linux would be good
candidates to handle in the hypervisor - clearing or copying to/from
a high page is a pretty frequent operation (provided there's enough
memory in the domain). While prior to the first submission I only
measured kernel builds (where the results are not hinting at a
meaningful improvement), I now found time to do a more specific
analysis: page clearing is being improved by about 20%, page copying
doesn't seem to significantly benefit (though that may be an effect of
the simplistic copy_page() implementation Xen currently uses) -
nevertheless I would think that if one function is supported by the
hypervisor, then the other should also be.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoConstify arguments to unmap_domain_page() etc.
Keir Fraser [Mon, 27 Oct 2008 13:27:33 +0000 (13:27 +0000)]
Constify arguments to unmap_domain_page() etc.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: First fixmap entry (0) is invalid.
Keir Fraser [Mon, 27 Oct 2008 13:26:50 +0000 (13:26 +0000)]
x86: First fixmap entry (0) is invalid.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoPrint d->is_dying when dumping domain info.
Keir Fraser [Mon, 27 Oct 2008 13:23:58 +0000 (13:23 +0000)]
Print d->is_dying when dumping domain info.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: fix domain cleanup
Keir Fraser [Mon, 27 Oct 2008 13:22:43 +0000 (13:22 +0000)]
x86: fix domain cleanup

The preemptable page type handling changes modified free_page_type()
behavior without adjusting the call site in relinquish_memory(): Any
type reference left pending when leaving hypercall handlers is
associated with a page reference, and when successful free_page_type()
decrements the type refcount - hence relinquish_memory() must now also
drop the page reference.

Also, the recursion avoidance during domain shutdown somehow (probably
by me when I merged the patch up to a newer snapshot) got screwed up:
The avoidance logic in mm.c should short circuit levels below the top
one currently being processed, rather than the top one itself.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86/powernow: fix machine shutdown
Keir Fraser [Mon, 27 Oct 2008 13:20:52 +0000 (13:20 +0000)]
x86/powernow: fix machine shutdown

cpufreq_del_cpu() calls cpufreq_driver->exit() without checking
whether an exit() handler is present, and by adding an exit() handler
to powernow we can at once close the potential memory leak.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: Fix coding style in msi.c
Keir Fraser [Mon, 27 Oct 2008 11:56:57 +0000 (11:56 +0000)]
x86: Fix coding style in msi.c
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoserial: Fix IRQ enable/disable in tx interrupt handler.
Keir Fraser [Mon, 27 Oct 2008 11:27:31 +0000 (11:27 +0000)]
serial: Fix IRQ enable/disable in tx interrupt handler.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_32: Lock in map_domain_page() may be taken with IRQs disabled, and
Keir Fraser [Mon, 27 Oct 2008 10:49:20 +0000 (10:49 +0000)]
x86_32: Lock in map_domain_page() may be taken with IRQs disabled, and
hence must *always* disable IRQs.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoAdd 2 more permissions to the XSM/Flask default policy.
Keir Fraser [Mon, 27 Oct 2008 10:29:39 +0000 (10:29 +0000)]
Add 2 more permissions to the XSM/Flask default policy.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
17 years agox86: relax restrictions on reserved bits in L3 for 32on64 x86 guests
Keir Fraser [Mon, 27 Oct 2008 10:08:48 +0000 (10:08 +0000)]
x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests

A 32on64 guest cannot copy an existing pinned L3 entry to use as a new
L3 because COMPAT_L3_DISALLOW_MASK contains bits which are added to L3
entries by adjust_guest_l3e (U/S & R/W) or by the hardware (A & D).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
17 years agoCpufreq statistic update for SW_ANY coordination
Keir Fraser [Mon, 27 Oct 2008 10:06:58 +0000 (10:06 +0000)]
Cpufreq statistic update for SW_ANY coordination

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agoFix xm scsi-attach/detach/list for inactive managed domains
Keir Fraser [Mon, 27 Oct 2008 10:03:17 +0000 (10:03 +0000)]
Fix xm scsi-attach/detach/list for inactive managed domains

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agox86: Enable spinlock debugging earlier during boot.
Keir Fraser [Thu, 23 Oct 2008 14:38:52 +0000 (15:38 +0100)]
x86: Enable spinlock debugging earlier during boot.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Dom0 builder doesn't need to disable IRQs while running on dom0 pagetables.
Keir Fraser [Thu, 23 Oct 2008 14:38:27 +0000 (15:38 +0100)]
x86: Dom0 builder doesn't need to disable IRQs while running on dom0 pagetables.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Dom0 builder must run on a valid GDT at all times.
Keir Fraser [Thu, 23 Oct 2008 14:34:27 +0000 (15:34 +0100)]
x86: Dom0 builder must run on a valid GDT at all times.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoRemove accidentally checked-in xenpmd binary.
Keir Fraser [Thu, 23 Oct 2008 14:23:15 +0000 (15:23 +0100)]
Remove accidentally checked-in xenpmd binary.

17 years agohpet cpuidle: Observe IRQ-safe locking protocol.
Keir Fraser [Thu, 23 Oct 2008 11:01:03 +0000 (12:01 +0100)]
hpet cpuidle: Observe IRQ-safe locking protocol.

Otherwise, may encounter deadlock.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agospinlock: Add debug-build checks for IRQ-safe spinlocks.
Keir Fraser [Thu, 23 Oct 2008 10:53:52 +0000 (11:53 +0100)]
spinlock: Add debug-build checks for IRQ-safe spinlocks.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>